import Vue from 'vue'
import VueRouter from 'vue-router'
import layout from '../layout/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'layout',
    redirect: 'home',
    component: layout,
    children: [
      {
        path: 'home',
        component: () => import('@/views/home')
      },
      {
        path: 'find',
        component: () => import('@/views/find')
      },
      {
        path: 'library',
        component: () => import('@/views/library')
      },
      {
        path: 'login',
        component: () => import('@/views/login')
      },
      {
        path: 'searchUser',
        component: () => import('@/views/login/searchUser')
      },
      {
        path: 'playlist/:id',
        component: () => import('@/views/playlist/playlist')
      },
      {
        path: 'singer/:id',
        name: 'singer',
        component: () => import('@/views/singer')
      },
      {
        path: 'setting',
        component: () => import('@/views/setting')
      },
      {
        path: `search/:search_text`,
        name: 'search',
        component: () => import('@/views/search')
      },
      {
        path: 'liked/:id',
        component: () => import('@/views/library/components/liked-songs')
      },
      {
        path: 'artist',
        component: () => import('@/views/search/components/artist')
      },
      {
        path: 'album/:id',
        name: 'album',
        component: () => import('@/views/album/album')
      }
    ]
  }
]
const router = new VueRouter({
  routes
})

export default router
